import { BasicColumn, FormSchema } from '@/components/Table/index';

export const columns: BasicColumn[] = [
  {
    title: '机构名称',
    dataIndex: 'name',
    width: 150,
    align: 'center',
    sorter: true,
  },
  // {
  //   title: '组织部门名称',
  //   dataIndex: 'name1',
  //   width: 150,
  //   align: 'center',
  //   sorter: true,
  // },
  {
    title: '管理层级',
    dataIndex: 'layerString',
    width: 150,
    align: 'center',
    sorter: true,
  },
  {
    title: '机构编号',
    dataIndex: 'code',
    width: 150,
    align: 'center',
    sorter: true,
  },
  {
    title: '机构类型',
    dataIndex: 'typeName',
    width: 150,
    align: 'center',
    sorter: true,
  },
  {
    title: '创建时间',
    dataIndex: 'createdTime',
    width: 150,
    align: 'center',
    sorter: true,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '关键字',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      placeholder: '请输入机构名称/编号',
    },
  },
  {
    label: '状态',
    field: 'IsEnable',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请选择状态',
      options: [
        {
          label: '全部',
          value: '',
        },
        {
          label: '启用',
          value: true,
        },
        {
          label: '停用',
          value: false,
        },
      ],
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    field: 'name',
    label: '机构名称',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入机构名称 / 组织部门名称（必填）',
    },
  },
  {
    field: 'parentId',
    label: '机构层级',
    required: true,
    component: 'rwTreeSelect',
    componentProps: {
      type: 'org',
      unshiftOptions: [
        {
          name: "父级",
          id: "0",
          children: []
        }
      ],
    },
  },
  {
    field: 'typeCode',
    label: '机构类型',
    required: true,
    component: 'dictSelect',
    componentProps: {
      placeholder: '请选择添加组织类型（必选）',
      code: 'ORG_TYPE'
    },
  },
  {
    field: 'code',
    label: '机构编号',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请选择机构编号',
    },
  },
  {
    field: 'managerName',
    label: '负责人姓名',
    component: 'Input',
    componentProps: {
      placeholder: '请输入负责人姓名（非必填）',
    },
  },
  {
    field: 'managerPhone',
    label: '负责人手机号码',
    component: 'Input',
    componentProps: {
      placeholder: '请输入负责人手机号码（非必填）',
    },
  },
  {
    field: 'managerWeiXin',
    label: '负责人微信号',
    component: 'Input',
    componentProps: {
      placeholder: '请输入负责人微信号（非必填）',
    },
  },
  {
    field: 'managerTel',
    label: '负责人固话号码',
    component: 'Input',
    componentProps: {
      placeholder: '请输入负责人固话号码（非必填）',
    },
  },
  {
    field: 'managerEmail',
    label: '负责人邮箱',
    component: 'Input',
    componentProps: {
      placeholder: '请输入负责人邮箱地址（非必填）',
    },
  },
  {
    field: 'managerFax',
    label: '传真号',
    component: 'Input',
    componentProps: {
      placeholder: '请输入传真号（非必填）',
    },
  },

  {
    field: 'postalCode',
    label: '机构地区邮编',
    component: 'Input',
    componentProps: {
      placeholder: '请输入机构所属地区邮编（非必填）',
    },
  },
  {
    field: 'contactAddress',
    label: '机构联系地址',
    component: 'Input',
    colProps: { lg: 24, md: 24 },
    componentProps: {
      placeholder: '请输入机构联系地址填（非必填）',
    },
  },
  {
    field: 'remark',
    label: '备注',
    component: 'InputTextArea',
    colProps: { lg: 24, md: 24 },
    componentProps: {
      placeholder: '请输入备注',
    },
  },
  {
    field: 'isEnable',
    label: '是否生效',
    component: 'Switch',
    defaultValue: true,
    colProps: { lg: 24, md: 24 },
  },
];
